How to get data from form using POST in PHP


Dear All, I would like to share all of you about how to get data from form using $_POST in PHP.
Or you can download full project by click here

1- Create form

1
2
3
"index.php" method="post" name="frm">
"username" value="" type="text">
 


Note: action='index.php' mean when you click it will pass your data in input box to index.php file

for "method='post'" mean you pass data by using method post so when you get data in PHP you need get by using $_POST['nameinputform']

method='POST' mean when you submit you data it will not display on url that it different between method='GET' so normally, we use method POST when you don't want user to see data in form on url example: username and password and other...

2-Get Data from form

1
2
3
4
//get data from form input type
$username = $_POST['username'];
//display data after get it
echo username;

Any question please comment below.thanks

Hiring Services

  • Build website
  • Develop web application
  • Graphic design
  • Maintenance and Security
  • Update website
  • Seach Egning Organization
  • Other...

My Facebook